package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {

    /**
     * @param: [user]
     * @return: void
     * @description: 新增用户
     **/
    void insert(User user);

    /**
     * @param: [userId]
     * @return: com.sky.entity.User
     * @description: 根据 userId查询 User表
     **/
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);

    /**
     * @param: [openid]
     * @return: com.sky.entity.User
     * @description: 根据 openid查询 user
     **/
    @Select("select * from user where openid=#{openid}")
    User getByOpenid(String openid);

    /**
     * @param: [map]
     * @return: java.lang.Integer
     * @description: 根据 map中的时间统计用户数量
     **/
    Integer countByMap(Map map);

}
